<?php namespace Common\Model; 
use Hdphp\Model\Model;
//前台Individual 模型
class Individual extends Model{
	//指定MemberLogin表名
	protected $table = 'user';
	protected $validate = array(
		//array(字段名,验证方法,错误信息,验证条件,验证时间)	
		array('code','getCode','验证码不正确',3,3)
	); 
	
	//自动验证	验证码
	public function getCode(){
		$code = q('post.code');
		if(strtolower($code) != strtolower($_SESSION['code'])){
			return false;
		}
		return true;
	}
	
	
	//执行编辑
	public function edit(){
		//create准备数据
		if(!$this->create()) return false;
		//将数组转换成字符串
		$this->data['address_detail'] = implode('|', q('post.address_detail'));
		$this->data['birthday'] = implode('|', q('post.birthday'));
		//修改数据
		$this->save();
		return true;
	}
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	